using UnityEngine;
using System.Collections;

public class LogoScreen : MonoBehaviour {
	
	public Renderer mainTexture2D;
	public string sceneName;
	public float fadeAmount;
	public float stayTime;
	private float timer;
	private FadeIn fade;
	
	void Awake()
	{
		fade = (FadeIn) gameObject.AddComponent("FadeIn");
		gameObject.AddComponent("SceneChange");
		fade.createFade(fadeAmount);
	}
	
	void Update()
	{
		
		if(fade == null)
		{
			timer += Time.deltaTime;
		}
		
		if(timer > stayTime)
		{
			if(gameObject.GetComponent<SceneChange>().existFade())
			{
				gameObject.GetComponent<SceneChange>().createFade(sceneName, fadeAmount);
			}
		}

	}
}
